package com.tianshi.pxx.mapper;



import com.tianshi.pxx.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {


    /*
    *
    * 登录，查询用户是否存在
    * */
    @Select("SELECT * FROM user WHERE username = #{username} AND password = #{password}")
    User selectByUsernameAndPassword(User user);



    /*
    *
    * 注册用户，插入数据库
    * */
    @Insert("INSERT INTO user(username, password, email, phone, status, money,order_id,last_login, create_time) VALUES" +
            "(#{username}, #{password}, #{email}, #{phone}, #{status}, #{money},#{orderId}, #{lastLogin}, #{createTime})")
    Integer insert(User user);

    Integer update(User user);


    @Select("select * from user where id = #{id}")
    User selectById(Integer id);
}
